package com.guihuo.mq.rocket;

import com.alibaba.rocketmq.common.message.Message;

/**
 * 项目名称：middleware-learning
 * 类名称：RocketMQProducerTest
 * 类描述：RocketMQProducerTest
 * 创建时间：2019/1/11
 *
 * @author guihuo   (E-mail:1620657419@qq.com)
 * @version v1.0
 */
public class RocketMQProducerTest {

    public static void main(String[] args) {
        String mqNameServer = "127.0.0.1:9876";
        String mqTopics = "MQ-MSG-TOPICS-TEST";

        String producerMqGroupName = "PRODUCER-MQ-GROUP";
        RocketMQProducer mqProducer = new RocketMQProducer(mqNameServer, producerMqGroupName, mqTopics);
        mqProducer.init();

        for (int i = 0; i < 5; i++) {
            Message message = new Message();
            message.setBody(("I send message to RocketMQ " + i).getBytes());
            mqProducer.send(message);
        }

    }

}
